<template>
  <div>
    <el-col span="12">
      <el-form-item label="发布包名称" prop="publishTaskName">
        <el-input
          clearable
          style="width: 250px"
          size="large"
          placeholder="请输入发布包名称"
          v-model="form.publishTaskName"/>
      </el-form-item>
      <el-form-item label="上线日期" prop="onlineDate">
        <el-date-picker
          v-model="form.onlineDate"
          type="date"
          style="width: 250px"
          size="large"
          value-format="yyyy-MM-dd"
          placeholder="选择上线日期">
        </el-date-picker>
      </el-form-item>
    </el-col>
    <el-col span="12">
      <el-form-item label="发布编码" prop="demandCode">
        <el-tooltip content="填写格式为【系统_版本号_当前日期】" placement="top">
          <el-input
            clearable
            style="width: 250px"
            size="large"
            placeholder="请输入发布编码"
            v-model="form.demandCode"/>
        </el-tooltip>
      </el-form-item>
    </el-col>
  </div>
</template>
<script>

export default {
  name: 'SubmitPublish',
  model: {
    prop: 'form',
    event: 'changes'
  },
  props: {
    form: {
      type: Object
    }
  },
  data() {
    return {
    }
  },
  created() {
    this.initData()
  },
  methods: {
    initData() {
      const currentDate = new Date()
      // 将日期格式化为 "20240131" 这样的格式
      const formattedDate = currentDate.toLocaleDateString('en-CA', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\D/g, '')
      this.form.demandCode = '_' + '_' + formattedDate
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>

</style>
